﻿using FluentValidation.Attributes;
using Nop.Admin.Models.Common;
using Nop.Admin.Validators.XJ;
using Nop.Web.Framework;
using Nop.Web.Framework.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Nop.Admin.Models.XJ
{
	public class MaintenanceListModel
	{
		public MaintenanceListModel()
		{
			AvailableDepartments = new List<SelectListItem>();
			AvailableDepartmentMenus = new List<SelectMenuModel>();
			AvailableUsers = new List<SelectListItem>();
			AvailableIsExternals = new List<SelectListItem>();
			AvailableStates = new List<SelectListItem>();
		}
		/// <summary>
		/// 操作等级
		/// </summary>
		public int OperationLevel { get; set; }
		/// <summary>
		/// 报修编号
		/// </summary>
		public string SearchSNo { get; set; }
		/// <summary>
		/// 计划编号
		/// </summary>
		public string SearchPNo { get; set; }
		/// <summary>
		/// 巡检单号
		/// </summary>
		public string SearchXNo { get; set; }
		/// <summary>
		/// 巡检点
		/// </summary>
		public string SearchPlaceName { get; set; }
		/// <summary>
		/// 设备分类
		/// </summary>
		public string SearchCategoryName { get; set; }
		/// <summary>
		/// 设施设备
		/// </summary>
		public string SearchEquipmentName { get; set; }
		/// <summary>
		/// 报修说明
		/// </summary>
		public string SearchComment { get; set; }
		/// <summary>
		/// 责任部门
		/// </summary>
		[UIHint("SelectMenu")]
		public int SearchResponsibleDepartmentId { get; set; }
		/// <summary>
		/// 责任班组
		/// </summary>
		[UIHint("SelectMenu")]
		public int SearchResponsibleTeamId { get; set; }
		/// <summary>
		/// 责任人
		/// </summary>
		public int SearchResponsiblePersonId { get; set; }
		/// <summary>
		/// 维修人
		/// </summary>
		public int SearchMaintenancePersonId { get; set; }
		/// <summary>
		/// 报修部门
		/// </summary>
		[UIHint("SelectMenu")]
		public int SearchDepartId { get; set; }
		/// <summary>
		/// 报修人
		/// </summary>
		public int SearchUserId { get; set; }
		public int SearchPlanId { get; set; }
		/// <summary>
		/// 巡检点
		/// </summary>
		public int SearchPlaceId { get; set; }
		/// <summary>
		/// 设备分类
		/// </summary>
		public int SearchCategoryId { get; set; }
		/// <summary>
		/// 是领导指派
		/// </summary>
		public bool? SearchIsAssign { get; set; }
		[NopResourceDisplayName("是外援实施", isLocal: true)]
		public int SearchIsExternalId { get; set; }
		[NopResourceDisplayName("开始日期", isLocal: true)]
		[UIHint("DateNullable")]
		public DateTime? SearchCreatedFrom { get; set; }
		[NopResourceDisplayName("结束日期", isLocal: true)]
		[UIHint("DateNullable")]
		public DateTime? SearchCreatedTo { get; set; }
		/// <summary>
		/// 状态
		/// </summary>
		public int SearchState { get; set; }
		public IList<SelectListItem> AvailableDepartments { get; set; }
		/// <summary>
		/// 部门
		/// </summary>
		public IList<SelectMenuModel> AvailableDepartmentMenus { get; set; }
		public IList<SelectListItem> AvailableUsers { get; set; }
		public IList<SelectListItem> AvailableIsExternals { get; set; }
		public IList<SelectListItem> AvailableStates { get; set; }
	}
	[Validator(typeof(MaintenanceValidator))]
	public class MaintenanceModel : BaseNopEntityModel
	{
		public MaintenanceModel()
		{
			AvailableDepartments = new List<SelectMenuModel>();
			AvailableUsers = new List<SelectListItem>();
			Pictures = new List<string>();
		}
		[NopResourceDisplayName("维修编号", true)]
		public string SNo { get; set; }
		/// <summary>
		/// 巡检计划Id
		/// </summary>
		public int InspectionPlanId { get; set; }
		[NopResourceDisplayName("计划编号", true)]
		public string PNo { get; set; }
		[NopResourceDisplayName("巡检点", true)]
		public int PlaceId { get; set; }
		[NopResourceDisplayName("巡检点", true)]
		public string PlaceName { get; set; }
		[NopResourceDisplayName("设备分类", true)]
		public int CategoryId { get; set; }
		[NopResourceDisplayName("设备分类", true)]
		public string CategoryName { get; set; }
		[NopResourceDisplayName("情况说明", true)]
		public string Comment { get; set; }
		[NopResourceDisplayName("责任部门", true)]
		public int ResponsibleDepartmentId { get; set; }
		[NopResourceDisplayName("责任部门", true)]
		public string ResponsibleDepartmentName { get; set; }
		[NopResourceDisplayName("责任班组", true)]
		public int ResponsibleTeamId { get; set; }
		[NopResourceDisplayName("责任班组", true)]
		public string ResponsibleTeamName { get; set; }
		[NopResourceDisplayName("责任人", true)]
		public int ResponsiblePersonId { get; set; }
		[NopResourceDisplayName("责任人", true)]
		public string ResponsiblePersonName { get; set; }
		[NopResourceDisplayName("维修人", true)]
		public string MaintenancePersonNames { get; set; }
		[NopResourceDisplayName("维修备注", true)]
		public string MaintenanceComment { get; set; }
		[UIHint("DateNullable")]
		[NopResourceDisplayName("维修日期", true)]
		public DateTime? MaintenanceOn { get; set; }
		[NopResourceDisplayName("工时", true)]
		public int Hours { get; set; }
		[NopResourceDisplayName("工时", true)]
		public string HoursString { get; set; }
		[NopResourceDisplayName("评分", true)]
		public int Star { get; set; }
		[NopResourceDisplayName("评价", true)]
		public string Evaluation { get; set; }
		[NopResourceDisplayName("评价时间", true)]
		[UIHint("DateNullable")]
		public DateTime? EvaluationOn { get; set; }
		[NopResourceDisplayName("状态", true)]
		public int State { get; set; }
		[NopResourceDisplayName("状态", true)]
		public string StateName { get; set; }
		[NopResourceDisplayName("发起人", true)]
		public int CustomerId { get; set; }
		[NopResourceDisplayName("发起人", true)]
		public string CustomerName { get; set; }
		[NopResourceDisplayName("发起部门", true)]
		public string DepartmentName { get; set; }
		[NopResourceDisplayName("暂停", true)]
		public bool IsPause { get; set; }
		[NopResourceDisplayName("发起时间", true)]
		public DateTime CreatedOn { get; set; }
		[NopResourceDisplayName("是上级指派", true)]
		public bool IsAssign { get; set; }
		[NopResourceDisplayName("指派说明", true)]
		[AllowHtml]
		public string AssignComment { get; set; }
		[NopResourceDisplayName("是外援实施", true)]
		public bool IsExternal { get; set; }
		[NopResourceDisplayName("维修费用", true)]
		public decimal Total { get; set; }
		/// <summary>
		/// 可以确认
		/// </summary>
		public bool CanConfirm { get; set; }
		/// <summary>
		/// 可以指派
		/// </summary>
		public bool CanAssign { get; set; }
		/// <summary>
		/// 可以分配
		/// </summary>
		public bool CanAllocate { get; set; }
		/// <summary>
		/// 可以完工
		/// </summary>
		public bool CanComplete { get; set; }
		/// <summary>
		/// 可以评论
		/// </summary>
		public bool CanComment { get; set; }
		/// <summary>
		/// 部门班组
		/// </summary>
		public IList<SelectMenuModel> AvailableDepartments { get; set; }
		/// <summary>
		/// 人员
		/// </summary>
		public IList<SelectListItem> AvailableUsers { get; set; }
		/// <summary>
		/// 巡检图片
		/// </summary>
		public IList<string> Pictures { get; set; }
	}
}